<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:64:"/var/www/fish/application/crm/view/outboundmanager/editTask.html";i:1513844639;}*/ ?>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>小鱼ADMIN</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/public/static/css/font.css">
    <link rel="stylesheet" href="/public/static/css/bgadmin.css">
    <script type="text/javascript" src="/public/static/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/public/static/js/bgadmin.js"></script>
    <script type="text/javascript" src="/public/static/js/jquery.form.js"></script> 
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="bg-body">
        <form class="layui-form" action="#" method="post" id="mainForm">
          <input type="hidden" name="id" value="<?php echo $taskData['id']; ?>">
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>任务名称：</label>
              <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required" autocomplete="off" value="<?php echo $taskData['name']; ?>" class="layui-input">
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>任务部门：</label>
              <div class="layui-input-inline">
                <select name="dept_id_queue" id='id_dept'>
                  <option value="">请选择</option>
                  <option value="0">顶级部门</option>
                    <?php echo $options; ?>
                </select>
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>呼叫类型：</label>
              <div class="layui-input-inline">
                <select name="calltype" id='tasktype'>
                  <option value="autocall">自动外呼</option>
				  <option value="preview">预览式外呼</option>
                </select>
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>呼叫超时：</label>
              <div class="layui-input-inline">
                <input type="text" name="maxrecall_times"  value="<?php echo $taskData['maxrecall_times']; ?>" class="layui-input">
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>保存示闲：</label>
              <div class="layui-input-inline">
                <select name="save_not_dnd" id='id_save_not_dnd'>
					<option value="">请选择...</option>
					<option value="N">否</option>
					<option value="Y">是</option>
                </select>
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>队列超时：</label>
              <div class="layui-input-inline">
                <input type="text" name="toqueue_timeout" value="<?php echo $taskData['toqueue_timeout']; ?>" class="layui-input">
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>呼出前缀：</label>
              <div class="layui-input-inline">
                <input type="text" name="callout_pre" value="<?php echo $taskData['callout_pre']; ?>"  class="layui-input">
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>线路中继：</label>
              <div class="layui-input-inline">
                <select name="trunk" id='id_trunk'>
				  <?php if(is_array($trunk) || $trunk instanceof \think\Collection || $trunk instanceof \think\Paginator): $i = 0; $__LIST__ = $trunk;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
				  <option value="<?php echo $vo['name']; ?>"><?php echo $vo['name']; ?></option>
				  <?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>中继区号：</label>
              <div class="layui-input-inline">
                <input type="text" name="area_code" value="<?php echo $taskData['area_code']; ?>"  class="layui-input">
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>主叫号码：</label>
              <div class="layui-input-inline">
                <input type="text" name="callerid" value="<?php echo $taskData['callerid']; ?>" class="layui-input">
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>空闲倍率：</label>
              <div class="layui-input-inline">
                <input type="text" name="idle_ratio" value="<?php echo $taskData['idle_ratio']; ?>" class="layui-input">
              </div>
            </div>
			<div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>最大并发：</label>
              <div class="layui-input-inline">
                <input type="text" name="concurrence" id="id_concurrence" value="<?php echo $taskData['concurrence']; ?>" class="layui-input">
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>挂机示闲：</label>
              <div class="layui-input-inline">
                <select name="hangup_by_idle" id='id_hangup_by_idle'>
					<option value="">请选择...</option>
					<option value="N">否</option>
					<option value="Y">是</option>
                </select>
              </div>
            </div>
          </div>
          <div class="layui-form-item">
			<label class="layui-form-label">应答目标：</label>
			<div class="layui-input-block">
			  <input type="radio" name="answer_target" value="queue" title="队列" <?php echo $taskData['radio_queue']; ?>><!--队列-->
			  <input type="radio" name="answer_target" value="ivr" title="群呼(转队列)" <?php echo $taskData['radio_ivr']; ?> >
			  <input type="radio" name="answer_target" value="ivr_hungup" title="群呼(播放完挂断)" <?php echo $taskData['radio_hungup']; ?> >
			</div>
		  </div>
		  
		  <div class="layui-form-item">
			<div class="layui-inline">
			<label class="layui-form-label">加入方式：</label>
			<div class="layui-input-block">
			  <input type="radio" name="join_queue_method" value="by-self" title="坐席自己加入" <?php echo $taskData['radio_by_self']; ?>>
			  <input type="radio"  name="join_queue_method" value="by-admin"  title="管理员加入" <?php echo $taskData['radio_by_admin']; ?>>
			</div>
			</div>
			<div class="layui-inline">
				  <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>群呼语音：</label>
				  <div class="layui-input-inline">
					<select name="ivr_id" id='id_ivr_id'>
						<option value="">请选择...</option>
						<option value="qunhu">qunhu</option>
						<option value="saohao">saohao</option>
					</select>
				  </div>
			</div>
		  </div>
		  <div class="layui-form-item">
			<label class="layui-form-label">选择坐席：</label>
			<div class="layui-input-block" style="border:1px solid #dddddd;padding:10px;">
				<?php echo $arrUData; ?>
			</div>
		  </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <a  class="layui-btn" lay-filter="add"  id="save" lay-submit="">
                  提交
              </a>
          </div>
      </form>
    </div>
    <!--<script type="text/javascript" src="/public/static/crm/js/users/addTask.js"></script>-->
	<script>
	$(function(){
		$("#id_dept").val("<?php echo $taskData['dept_id']; ?>");
		$("#tasktype").val("<?php echo $taskData['calltype']; ?>");
		$("#id_save_not_dnd").val("<?php echo $taskData['save_not_dnd']; ?>");
		$("#id_trunk").val("<?php echo $taskData['trunk']; ?>");
		$("#id_hangup_by_idle").val("<?php echo $taskData['hangup_by_idle']; ?>");
		$("#id_ivr_id").val("<?php echo $taskData['ivr_id']; ?>");
	})
	
	
	layui.use('form', function(){
	  var form = layui.form;
	  var ajax_option={  
		url:"updateTask",  
		success:function(data){  
		  var result = $.parseJSON(data); 
		  if (result.success) {  
			layer.alert(result.msg, {icon: 6}, function(index){
			  layer.close(index);
			  bg_admin_close();
			  // parent.location.replace("/index.php/crm/OutboundManager/outboundTaskList");
			});
		  } else {  
			layer.alert(result.msg, {icon: 5}, function(index){
			  layer.close(index);
			}); 
		  }  
		}  
	  };  

	  form.on('submit(add)', function(data){
		$('#mainForm').ajaxSubmit(ajax_option);  
		return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
	  });  
	});
	
	
	
	</script>
  </body>

</html>